home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / dev / gui / DesignerV1_53.lha / Designer / PubScreenDemo / PubScreenDemoP1.pas < prev    next >
Pascal/Delphi Source File  |  1995-04-28  |  2KB  |  87 lines

  1. program PubScreenDemoP1;
  2.  
  3. Uses exec,intuition,gadtools,graphics,amiga,diskfont,
  4.      workbench,utility,PubScreenDemop1Win;
  5.  
  6.  
  7. Var
  8.  done  : boolean;
  9.  class : long;
  10.  code  : word;
  11.  pgsel : pGadget;
  12.  imsg  : pintuimessage;
  13.  dummy : long;
  14.  Scr   : pscreen;
  15. Begin
  16. done:=false;
  17. if OpenLibs then
  18.     Begin
  19.     Scr:=openMyPubScrscreen;
  20.     if scr<>nil then
  21.         begin
  22.         if OpenWindowScrWin( Scr ) then
  23.             begin 
  24.             if pubscreenstatus(scr,0)=0 then;
  25.             while (not done) do
  26.                 begin
  27.                 dummy:=Wait(bitmask(ScrWin^.UserPort^.mp_SigBit));
  28.                 
  29.                 imsg:=GT_GetIMsg(ScrWin^.UserPort);
  30.                 while (imsg <>nil ) do
  31.                     begin
  32.                     class:=imsg^.Class;
  33.                     code:=imsg^.Code;
  34.                     pgsel:=pgadget(imsg^.IAddress); { Only reference if it is a gadget message }
  35.                     GT_ReplyIMsg(imsg);
  36.                     if (class=IDCMP_CLOSEWINDOW) then
  37.                         begin
  38.                         CloseWindowScrWin;
  39.                         if closescreen(scr) then
  40.                               begin
  41.                                 done:=true;
  42.                                 scr:=nil;
  43.                               end
  44.                         else
  45.                             begin
  46.                             if not OpenWindowScrWin( Scr ) then
  47.                                 begin
  48.                                 writeln('Could not reopen window, program failed.');
  49.                                 done:=true;
  50.                                 end;
  51.                             end;
  52.                         end;
  53.                     if (class=IDCMP_REFRESHWINDOW) then
  54.                         begin
  55.                         GT_BeginRefresh(ScrWin);
  56.                         GT_EndRefresh(ScrWin, TRUE);
  57.                         end;
  58.                     if (class=IDCMP_GADGETUP) then
  59.                         begin
  60.                         if pgsel^.gadgetid=state then
  61.                             case code of
  62.                                 0 : if pubscreenstatus(scr,0)=0 then;
  63.                                 1 : if pubscreenstatus(scr,psnf_private)=0 then;
  64.                             end;
  65.                         end;
  66.                     imsg:=nil;
  67.                     if scrwin<>nil then
  68.                         imsg:=GT_GetIMsg(ScrWin^.UserPort);
  69.                     end;
  70.                 
  71.                 end;
  72.             if scrwin<>nil then
  73.                   closewindowscrwin;
  74.             end
  75.         else
  76.             writeln('Cannot open window.');
  77.         if Scr<>nil then
  78.           if CloseScreen(Scr) then;
  79.         end
  80.     else
  81.         writeln('Cannot Open Screen.');
  82.     CloseLibs;
  83.     end
  84. else
  85.     writeln('Cannot open libraries.');
  86. end.
  87.